/* 
    网页音乐相关的api
*/
var express = require("express");
var router = express.Router();
var path = require('path')
var fs = require('fs');
var iconv = require('iconv-lite');

//获取歌词
router.get('/getLrc', (req, res) => {
    let song = req.query.name.replace(/\"/g, "");
    var fileStr = fs.readFileSync(`public/music/${song}/1.txt`, { encoding: 'binary' });
    var buf = new Buffer(fileStr, 'binary');
    var str = iconv.decode(buf, 'GBK');
    res.send(str)
})


module.exports = router
